// pages/menu/report/process/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  onLoad(options){
    let {process} = options
    process = JSON.parse(process)
    process.reverse()
    let endTime = ""
    if(process[0].state.indexOf("解决") != -1){
      endTime = process[0].time
    }else{
      endTime = "正在进行中..."
    }
    let active = 0
    let steps = process.map((item)=>{
      if(item.description){
        return {
          text:"[ "+item.state+" ]",
          desc:`${item?.description} ${item.time}`,
        }
      }else{
        return{
          text:"[ "+item.state+" ]",
          desc:item.time,
        }
      }
      
    })

    this.setData({
      active,
      steps,
      createdTime:process.at(-1).time,
      endTime
    })
  }
})